public class BankAccount {
    private String accountNumber;
    private double balance;
    private String accountHolder;


    public BankAccount(String accountNumber, double initialBalance, String accountHolder) {
        this.accountNumber = accountNumber;
        this.balance = initialBalance;
        this.accountHolder = accountHolder;
    }


    public void deposit(double amount) {
        if (amount > 0) {
            balance += amount;
            System.out.println("成功存入 " + amount + " 元");
        } else {
            System.out.println("存款金额必须大于零");
        }
    }


    public void withdraw(double amount) {
        if (amount > 0 && amount <= balance) {
            balance -= amount;
            System.out.println("成功取出 " + amount + " 元");
        } else {
            System.out.println("取款金额无效或余额不足");
        }
    }
    public void displayAccountInfo() {
        System.out.println("账户号: " + accountNumber);
        System.out.println("账户持有人: " + accountHolder);
        System.out.println("余额: " + balance);
    }

}
